<!-- 简单排序列表 -->
<template>
	<view
		:style="'order:'+Item.order+';'+Item.css"
		class="list-concise">
		<template v-if="listState == 'success'">
			<view
				@click="$_To('post/post?pid='+item.pid)"
				class="for"
				v-for="(item,index) in list">
				<text class="order">{{index+1}}.</text>
				<text class="title">
					{{item.title?item.title:$_filterHtml(item.content)}}
				</text>
			</view>
			<view
				v-if="Item.page"
				@click="getList('more')"
				class="more">点击加载更多</view>
		</template>
		<template v-if="listState == 'loading'">
			<view class="skeleton-screen" v-for="item in Item.query.pageSize?Item.query.pageSize:1">
				<view class="loading-css"></view>
				<view class="loading-css"></view>
			</view>
		</template>
		<template v-if="listState == 'empty'">
			<public-empty></public-empty>
		</template>
	</view>
</template>

<script>
	export default {
		name:"list-concise",
		props:{
			Item:{
				type:Object,
				default:null
			},
			YrConfig:{
				type:String,
				default:""
			},
			listGid:{
				type:String,
				default:""
			},
			listHid:{
				type:String,
				default:""
			}
		},
		data() {
			return {
				list:[],
				listState:"loading",
				listPage:2
			};
		},
		mounted(){
			this.getList();
		},
		// 卸载组件
		destroyed(){
			
		},
		methods: {
			getList(more){
				if(this.Item.query.gid == 'empty'){
					this.Item.query.gid = "";
					this.listGid = ""
				}
				if(this.Item.query.hid == 'empty'){
					this.Item.query.hid = "";
					this.listHid = ""
				}
				if(more == 'more'){uni.showLoading({ title: "加载中" });}
				this.$_Request(
					"GET","/api/v2/post/list",
					{
						"mapId": this.Item.query.mapId,
						"mapLng": this.Item.query.mapLng,
						"mapLat": this.Item.query.mapLat,
						"uidOrUsername": this.Item.query.uidOrUsername,
						"hid": this.Item.query.hid?this.Item.query.hid:this.listHid,
						"gid": this.Item.query.gid?this.Item.query.gid:this.listGid,
						"includeSubgroups": this.Item.query.includeSubgroups,
						"allDigest": this.Item.query.allDigest,
						"digestState": this.Item.query.digestState,
						"stickyState": this.Item.query.stickyState,
						"contentType": this.Item.query.contentType,
						"createdDays": this.Item.query.createdDays,
						"createdDate": this.Item.query.createdDate,
						"createdDateGt": this.Item.query.createdDateGt,
						"createdDateLt": this.Item.query.createdDateLt,
						"likeCountGt": this.Item.query.likeCountGt,
						"likeCountLt": this.Item.query.likeCountLt,
						"followCountGt": this.Item.query.followCountGt,
						"followCountLt": this.Item.query.followCountLt,
						"blockCountGt": this.Item.query.blockCountGt,
						"blockCountLt": this.Item.query.blockCountLt,
						"commentCountGt": this.Item.query.commentCountGt,
						"commentCountLt": this.Item.query.commentCountLt,
						"orderType": this.Item.query.orderType,
						"orderDirection": this.Item.query.orderDirection,
						"blockGroups": this.Item.query.blockGroups + this.YrConfig,
						"blockHashtags": this.Item.query.blockHashtags,
						"pluginRatingId": this.Item.query.pluginRatingId,
						"pageSize": this.Item.query.pageSize,
						"page":more == 'more' ? this.listPage : "",
						"whitelistKeys":"pid,title,content"
					},
					(res) => {
						if(more == 'more'){
							if(res.data.data.list.length){
								this.list = this.list.concat(res.data.data.list);
								this.listPage++
								uni.hideLoading();
							}else{
								uni.showToast({
									title: "没有数据啦",
									icon: "none",
									duration: 1000
								});
							}
							this.$store.commit('mutationsStateonReachBottomStatus',true)
						}else{
							if(res.data.data.list.length){
								this.list = res.data.data.list;
								this.listState = "success"
							}else{
								this.listState = "empty"
							}
						}
					}
				)
			}
		},
	}
</script>

<style lang="scss" scoped>
.list-concise{
	.for{
		display: flex;
		align-items: center;
		border-bottom: 1rpx dashed $BianKuangSe;
		padding: 25rpx 0;
		.order{
			color: $ZhanWeiSe;
			padding-right: 15rpx;
		}
		.title{
			display: -webkit-box;
			/*!autoprefixer:off*/
			-webkit-box-orient: vertical;
			/*autoprefixer:on*/
			-webkit-line-clamp: 1;
			overflow: hidden;
		}
	}
	.for:nth-child(1){
		.order{
			color: $LanSe;
		}
	}
	.for:nth-child(2){
		.order{
			color: $HongSe;
		}
	}
	.for:nth-child(3){
		.order{
			color: $JuHuang;
		}
	}
	.more{
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		line-height: 28rpx;
		color: $ZhanWeiSe;
		padding: 35rpx 0;
	}
}
.skeleton-screen{
	display: flex;
	align-items: center;
	border-bottom: 1rpx dashed $BianKuangSe;
	padding: 25rpx 0;
	view:nth-child(1){
		width: 50rpx;
		height: 50rpx;
		border-radius: 100%;
	}
	view:nth-child(2){
		margin-left: 15rpx;
		flex: 1;
		height: 50rpx;
	}
}
</style>